
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n,t;
    cin>>n>>t;
    ll a[n+1];
    ll sumji=0;
    ll sumou=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        if(i%2==0)sumou+=a[i];
        else sumji+=a[i];
    }

    ll valji=0;
    ll valou=0;
    while(t--)
    {
        int option=0;
        cin>>option;
        if(option==1)
        {
            ll l,r,w;
            int countji=0;int countou=0;
           cin>>l>>r>>w;
            int n=r-l+1;
            //统计偶数和技术的个数
            if(n==1)
            {
                if(l%2!=0)countji++;
                else countou++;
            }
            else if(n%2==0)
            {
                countji+=n/2;countou+=n/2;
            }
            else 
            {
                if(l%2!=0)
                {
                    countji+=n/2+1;
                    countou+=n/2;
                }
                else 
                {
                    countji+=n/2;
                    countou+=n/2+1;
                }
            }
            valji+=countji*w;
            valou+=countou*w;
        }
        else if (option==2)
        {
            ll tmp=0;cin>>tmp;
            if(tmp==1)
            {    
                cout<<sumji+valji;
            }
            else if (tmp==2)
            {
                cout<<sumou+valou;
            }
            
            if(t)cout<<endl;
        }
    }
    return 0;
}
